package com.cizzy.comment.entity.dto;

import com.baomidou.mybatisplus.annotation.TableId;
import com.cizzy.comment.entity.dao.CommentDAO;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serial;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * <p>
 *
 * </p>
 *
 * @author terry
 * @since 2023-11-04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "Comment对象", description = "")
public class CommentDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @TableId("comment_id")
    private Long commentId;

    private Timestamp createAt;

    private Long videoId;

    private Long parentCommentId;

    private Long userId;

    private String content;

    public void convertFromCommentDAO(CommentDAO commentDAO) {
        this.commentId = commentDAO.getCommentId();
        this.createAt = commentDAO.getCreateAt();
        this.videoId = commentDAO.getVideoId();
        this.parentCommentId = commentDAO.getParentCommentId();
        this.userId = commentDAO.getUserId();
        this.content = commentDAO.getContent();
    }
}
